package cn.itsource.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.jws.soap.SOAPBinding;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/json")//= @Controller+@ReponseBody
public class JsonController {
    @RequestMapping("/01")
    public String _01(){
        return "直接返回！";
    }

    @RequestMapping("/02")
    public User _02(){
        User user = new User();
        user.setName("张三");
        return user;
    }

    @RequestMapping("/03")
    public List<User> _03(){
        List<User> users = Arrays.asList(new User(1L, "小王"), new User(2L, "小孙"));
        return users;
    }

    @RequestMapping("/04")
    public Map<String,Object> _04(){
        Map<String,Object> map = new HashMap<>();
        map.put("success","true" );
        map.put("msg","成功！" );
        return map;
    }
}
